package com.zhoug.demo.common.designpattern;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * @author: zhoug
 * @since: 2025-07-08
 */
public enum AppConfig {
    INSTANCE;
    private SharedPreferences prefs;

    public void init(Context context) {
        prefs = context.getSharedPreferences("config", Context.MODE_PRIVATE);
    }

    public String getApiKey() {
        return prefs.getString("API_KEY", "");
    }

    public void setUserToken(String token) {
        prefs.edit().putString("TOKEN", token).apply();
    }
}
